#ifndef GY_BUTTONDELEGETE_H
#define GY_BUTTONDELEGETE_H

#include "GY_ControlLibrary_global.h"
#include <QStyledItemDelegate>
#include <QObject>

class GY_ButtonDelegete : public QStyledItemDelegate
{
    Q_OBJECT
public:
    GY_ButtonDelegete(QObject *parent = nullptr);

    //重新绘制按钮
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
    //响应按钮事件
    bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;

signals:
    void clicked(const QModelIndex &index);
};

#endif // GY_BUTTONDELEGETE_H
